﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Conis.Squirrel
{
    public class RSSItem
    {
        public class ItemSource
        {
            /// <summary>
            /// 说明该项（item）来自那个 RSS 频道的名
            /// </summary>
            public string Text { get; set; }
            /// <summary>
            ///它有一个必须的属性url指定XML源
            /// </summary>
            public string URL { get; set; }
        }

        /// <summary>
        /// 包括项（item）的一个或多个分类
        /// </summary>
        public class ItemCategory
        {
            /// <summary>
            /// 分类的名称
            /// </summary>
            public string Text { get; set; }
            /// <summary>
            ///域名，确定指定分类中的一个分级位置
            /// </summary>
            public string Domain { get; set; }
        }

        /// <summary>
        /// 支持和该项（item）有关的媒体对象
        /// </summary>
        public class ItemEnclosure
        {
            public string Type { get; set; }
            public Int64 Length { get; set; }
            public string URL { get; set; }
            public ItemEnclosure(string type, Int64 length, string url)
            {
                this.Type = type;
                this.Length = length;
                this.URL = url;
            }
        }

        /// <summary>
        /// 项（item）的标题
        /// </summary>
        public string Title { get; set; }
        /// <summary>
        /// 项（item）的URL
        /// </summary>
        public string Link { get; set; }
        /// <summary>
        /// 项（item）的大纲
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// 项（item）作者的Email 地址
        /// </summary>
        public string Author { get; set; }
        /// <summary>
        /// 包括项（item）的一个或多个分类
        /// </summary>
        public ItemCategory Category { get; set; }
        /// <summary>
        /// 关于项（item）的注释页的URL
        /// </summary>
        public string Comments { get; set; }
        /// <summary>
        /// 支持和该项（item）有关的媒体对象
        /// </summary>
        public ItemEnclosure Enclosure { get; set; }
        /// <summary>
        /// 唯一与该项（item）联系在一起的永久性链接
        /// </summary>
        public string GUID { get; set; }
        /// <summary>
        /// 该项（item）是什么时候发布的
        /// </summary>
        public DateTime PubDate { get; set; }
        /// <summary>
        /// 该项（item）来自哪个RSS 频道，当把项（item）聚合在一起时非常有用
        /// </summary>
        public ItemSource Source { get; set; }

        public RSSItem(string title, string link, string description)
        {
            this.Title = title;
        }

        public RSSItem(string title)
        {
            this.Title = title;
        }
    }
}
